package Lee_code;

import java.util.Arrays;

public class Lee_455 {

    //g是人的胃口,s是饼干
    public int findContentChildren(int[] g, int[] s) {
        if (s.length==0)
            return 0;
        Arrays.sort(g);
        Arrays.sort(s);
        int count=0;
        //point1指向胃口 point2指向饼干
        int point1=0, point2=0;
        while( point1<g.length && point2<s.length )
        {
            if(s[point2]>=g[point1])
            {
                count++;
                point2++;
                point1++;
            }
            else if(s[point2] < g[point1])
            {
                point2++;
            }
        }
        return count;
    }
    public static void main(String[] args) {

    }
}
